package com.itheima.service.impl;

import com.itheima.dao.SetmealCheckgroupDao;
import com.itheima.pojo.SetmealCheckgroup;
import com.itheima.service.SetmealCheckgroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SetmealCheckgroupServiceImpl implements SetmealCheckgroupService {
    @Autowired
    private SetmealCheckgroupDao setmealCheckgroupDao;
    /**
     * 根据套餐id删除所有关联的检查组
     * @param setmealId
     */
    @Override
    public void deleteBySetmealId(Integer setmealId) {
        setmealCheckgroupDao.deleteBySetmealId(setmealId);
    }

    /**
     * 重新添加新的关联的检查组
     */
    @Override
    public void saveSetmealCheckgroup(SetmealCheckgroup setmealCheckgroup) {
        setmealCheckgroupDao.saveSetmealCheckgroup(setmealCheckgroup);
    }

    //根据套餐id查询对应的检查组id集合
    @Override
    public List<Integer> getCheckgroupById(Integer id) {
        List<Integer> ids = setmealCheckgroupDao.getCheckgroupById(id);
        return ids;
    }
}
